﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SystemUnitClassCollectionViewModel.cs" >
//   J. Prinz
// </copyright>
// <summary>
//   ViewModel representing a collection of SystemUnitClassViewModels <see cref="SystemUnitClassViewModel" />
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace AutomationMLMapper.ViewModels.CAEXObjectCollectionViewModels
{
    using AutomationMLMapper.Properties;
    using AutomationMLMapper.ViewModels.CAEXObjectViewModels;
    using AutomationMLMapper.ViewModels.SystemViewModels;

    /// <summary>
    ///   ViewModel representing a collection of SystemUnitClassViewModels <see cref="SystemUnitClassViewModel" />
    /// </summary>
    public class SystemUnitClassCollectionViewModel : CAEXObjectCollectionViewModel<SystemUnitClassViewModel>
    {
        #region Fields

        /// <summary>
        ///  <see cref="ExpandClassAttributes"/>
        /// </summary>
        private bool expandClassAttributes;

        /// <summary>
        ///  <see cref="ExpandInstanceOfClass"/>
        /// </summary>
        private bool expandInstanceOfClass;

        /// <summary>
        /// <see cref="ExpandPropertySets"/>
        /// </summary>
        private bool expandPropertySets;

        /// <summary>
        ///  <see cref="ExpandSupportedRoles"/>
        /// </summary>
        private bool expandSupportedRoles;

        /// <summary>
        ///  <see cref="ShowClassAttributes"/>
        /// </summary>
        private bool showClassAttributes;

        /// <summary>
        ///  <see cref="ShowInstanceOfClass"/>
        /// </summary>
        private bool showInstanceOfClass;

        /// <summary>
        ///   <see cref="ShowPropertySets"/>
        /// </summary>
        private bool showPropertySets;

        /// <summary>
        ///  <see cref="ShowSupportedRoles"/>
        /// </summary>
        private bool showSupportedRoles;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SystemUnitClassCollectionViewModel"/> class. 
        /// </summary>
        /// <param name="parent">
        /// should be a SystemViewModel <see cref="SystemViewModel"/> 
        /// </param>
        public SystemUnitClassCollectionViewModel(ICAEXObject parent)
            : base(parent)
        {
            this.ShowSupportedRoles = false;
            this.ShowPropertySets = false;
            this.ShowClassAttributes = false;
            this.ShowInstanceOfClass = false;

            this.ExpandSupportedRoles = true;
            this.ExpandPropertySets = true;
            this.ExpandClassAttributes = true;
            this.ExpandInstanceOfClass = true;
        }

        #endregion

        #region Public Properties

        /// <summary>
        ///   DisplayName of the Collection in the UI used in Headers and Labels
        /// </summary>
        public new string DisplayName
        {
            get
            {
                return Resources.SystemUnitClasses;
            }
        }

        /// <summary>
        ///   Visibility of the Attributes of the SystemUnitClasses
        /// </summary>
        public bool ExpandClassAttributes
        {
            get
            {
                return this.expandClassAttributes;
            }

            set
            {
                this.expandClassAttributes = value;
                foreach (var suc in this.Elements)
                {
                    suc.AttributesCollection.IsExpanded = value;
                }

                this.OnNotifyPropertyChanged("ExpandClassAttributes");
            }
        }

        /// <summary>
        ///   Visibility of the Instances of the SystemUnitClasses
        /// </summary>
        public bool ExpandInstanceOfClass
        {
            get
            {
                return this.expandInstanceOfClass;
            }

            set
            {
                this.expandInstanceOfClass = value;
                foreach (var suc in this.Elements)
                {
                    suc.InstancesCollection.IsExpanded = value;
                }

                this.OnNotifyPropertyChanged("ExpandInstanceOfClass");
            }
        }

        /// <summary>
        ///   Visibility of the PropertySets of the SystemUnitClasses
        /// </summary>
        public bool ExpandPropertySets
        {
            get
            {
                return this.expandPropertySets;
            }

            set
            {
                this.expandPropertySets = value;
                foreach (var suc in this.Elements)
                {
                    suc.PropertySetCollection.IsExpanded = value;
                }

                this.OnNotifyPropertyChanged("ExpandPropertySets");
            }
        }

        /// <summary>
        ///   Expansionstate of the SupportedRoleClasses of the SystemUnitClasses
        /// </summary>
        public bool ExpandSupportedRoles
        {
            get
            {
                return this.expandSupportedRoles;
            }

            set
            {
                this.expandSupportedRoles = value;
                foreach (var suc in this.Elements)
                {
                    suc.RolesCollection.IsExpanded = value;
                }

                this.OnNotifyPropertyChanged("ExpandSupportedRoles");
            }
        }

        /// <summary>
        ///   Visibility of the Attributes of the SystemUnitClasses
        /// </summary>
        public bool ShowClassAttributes
        {
            get
            {
                return this.showClassAttributes;
            }

            set
            {
                this.showClassAttributes = value;
                this.OnNotifyPropertyChanged("ShowClassAttributes");
            }
        }

        /// <summary>
        ///   Visibility of the Instances of the SystemUnitClasses
        /// </summary>
        public bool ShowInstanceOfClass
        {
            get
            {
                return this.showInstanceOfClass;
            }

            set
            {
                this.showInstanceOfClass = value;
                this.OnNotifyPropertyChanged("ShowInstanceOfClass");
            }
        }

        /// <summary>
        ///  Visibility of the PropertySets of the SystemUnitClasses
        /// </summary>
        public bool ShowPropertySets
        {
            get
            {
                return this.showPropertySets;
            }

            set
            {
                this.showPropertySets = value;
                this.OnNotifyPropertyChanged("ShowPropertySets");
            }
        }

        /// <summary>
        ///  Visibility of the SupportedRoleClasses of the SystemUnitClasses
        /// </summary>
        public bool ShowSupportedRoles
        {
            get
            {
                return this.showSupportedRoles;
            }

            set
            {
                this.showSupportedRoles = value;
                this.OnNotifyPropertyChanged("ShowSupportedRoles");
            }
        }

        #endregion
    }
}